package mf.com.controller.product;

import com.github.pagehelper.PageInfo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import mf.com.Service.Product.ProductService;
import mf.com.dto.product.ProductDto;
import mf.com.entity.product.Product;
import mf.com.vo.common.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: lmf
 * @Create: 2024/4/10 21:34
 * Description:  商品控制层
 */
@RestController
@Tag(name = "商品管理")
@RequestMapping("/admin/product/product")
public class productController {
    @Resource
    private ProductService productService;

    @GetMapping("/{pageNum}/{pageSize}")
    @Operation(summary="列表分页查询")
    public Result<PageInfo<Product>> findByPage(@PathVariable("pageNum") Integer pageNum,
                                                @PathVariable("pageSize") Integer pageSize,
                                                ProductDto product) {
        return Result.success(productService.findByPage(product, pageNum, pageSize));
    }
}
